MCQ Answer

If a={5,6,7}, what happens when a.add(5) is executed?

If a={5,6,7}, what happens when a.add(5) is executed?

यदि a = {5,6,7}, तो क्या होता है जब a.add (5) निष्पादित होता है?
Topic : Sequence data types in python

A. a={5,5,6,7}

B. a={5,6,7}

C. Error as there is no add function for set data type एरर के रूप में सेट डेटा प्रकार के लिए कोई फ़ंक्शन नहीं है

D. Error as 5 already exists in the set 5 के रूप में एरर पहले से ही सेट में मौजूद है




Correct Answer is :

B. a={5,6,7}



Explanation
There exists add method for set data type. However 5 isn’t added again as set consists of only non-duplicate elements and 5 already exists in the set. Execute in python shell to verify.
Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2024 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz